/*******************************************************************************
Replication Materials for Blau, Kahn, Brummund, Cook, and Larson-Koester "Is 
There Still Son Preference in the United States?"

Table R3

Date Modified: 10/19/2019

*******************************************************************************/




*-------------------------------------------------------------------------------
                                   *LOAD DATA
*-------------------------------------------------------------------------------
use "$acs\acs_data", clear

*-------------------------------------------------------------------------------
                                 *RESTRICT SAMPLE
*-------------------------------------------------------------------------------
keep if nonrkids == 0 & nonusbirth == 0 & sfrelate == 0 & father_sample != 1 ///
	& multi_sample != 1 & mult == 0 & female == 1 & oldc <=12 & ///
	inrange(age,18,40)==1 & foster_hh == 0 & nchild18>=1
drop if marst == 5
drop if citizen == 1

*-------------------------------------------------------------------------------
                                 *GENERATE VARS
*-------------------------------------------------------------------------------
gen inlf = empstat != 3

*-------------------------------------------------------------------------------
                           *REGRESSIONS, MARRIED WOMEN
*-------------------------------------------------------------------------------
label var chld1 "First Child Girl"
local wgt "hhwtnorm"
local controls "lths scol cold" //leave out: hsdi
local controls "`controls' i.genrace i.region i.year age age2 age3" 

// NATIVE
reg inlf chld1 `controls' if native == 1 & marst == 1 [aw=`wgt'], robust
sum inlf if native == 1 & marst == 1 [aw=`wgt']
local mean: display %5.4f  r(mean)
outreg2 using "$routput\TA_R3", replace excel dec(4) addtext(Dep. Var. Mean, `mean') keep(chld1) ctitle(Married, Native) label nocons nor2 ///
	title("Table R3: Table AT4, No Spousal Controls")

// IMMIGRANT
reg inlf chld1 `controls' if native == 0 & marst == 1 [aw=`wgt'], robust
sum inlf if native == 0 & marst == 1 [aw=`wgt']
local mean: display %5.4f  r(mean)
outreg2 using "$routput\TA_R3", append excel dec(4) addtext(Dep. Var. Mean, `mean') keep(chld1) ctitle(Married, Immigrant) label nocons nor2


// BOTH
reg inlf chld1 `controls' if marst == 1 [aw=`wgt'], robust
sum inlf if  marst == 1 [aw=`wgt']
local mean: display %5.4f  r(mean)
outreg2 using "$routput\TA_R3", append excel dec(4) addtext(Dep. Var. Mean, `mean') keep(chld1) ctitle(Married, Both) label nocons nor2		

*-------------------------------------------------------------------------------
                              *REGRESSIONS, ALL WOMEN
*-------------------------------------------------------------------------------
local wgt "hhwtnorm"
local controls "lths scol cold" //leave out: hsdi
local controls "`controls' i.genrace i.region i.year age age2 age3"

// NATIVE
reg inlf chld1 `controls' if native == 1 [aw=`wgt'], robust
sum inlf if native == 1 [aw=`wgt']
local mean: display %5.4f  r(mean)
outreg2 using "$routput\TA_R3", append excel dec(4) addtext(Dep. Var. Mean, `mean') keep(chld1) ctitle(All, Native) label nocons nor2 

// IMMIGRANT
reg inlf chld1 `controls' if native == 0 [aw=`wgt'], robust
sum inlf if native == 0 [aw=`wgt']
local mean: display %5.4f  r(mean)
outreg2 using "$routput\TA_R3", append excel dec(4) addtext(Dep. Var. Mean, `mean') keep(chld1) ctitle(All, Immigrant) label nocons nor2

// BOTH
reg inlf chld1 `controls' [aw=`wgt'], robust
sum inlf  [aw=`wgt']
local mean: display %5.4f  r(mean)
outreg2 using "$routput\TA_R3", append excel dec(4) addtext(Dep. Var. Mean, `mean') keep(chld1) ctitle(All, Both) label nocons nor2	